<template>
    <NodeViewWrapper as="span" :class="'c-contract ' + node.attrs.type">
        <span style="margin-right: 6px;">
            {{ node.attrs.demo }}<i v-if="node.attrs.unit">{{ node.attrs.unit }}</i>
        </span>
        <IPenLine @click="edit" class="edit-icon" />
    </NodeViewWrapper>
</template>
<script>
import IPenLine from '@icons/pen-line'
import { defineComponent } from 'vue'
export default defineComponent({
    components: { IPenLine },
    inject: ['updateAttributes'],
    node: Object,
    methods: {
        edit() {
            $.emit('J_contract', this.node.attrs, (formData) => {
                this.updateAttributes(formData)
            })
        }
    },
})
</script>
